package com.org.forex;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;

import java.awt.BorderLayout;
import java.awt.GridLayout;

public class ResultChartWindow {

	private JFrame frame;
	private ChartPanel panel;
	private JFreeChart chart;

	/**
	 * Create the application.
	 */
	public ResultChartWindow(JFreeChart chart) {
		this.chart = chart;
		initialize();
	}

	public void show() {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));

		panel = new ChartPanel(chart);
		panel.setChart(chart);
		frame.getContentPane().add(panel);
	}

}
